var pro_load_page = 2,pro_load_flag = true;
var fansShopDetail={
	init : function(level){
		app.ajax(
			'/Member/Shop/getRecEqualLevelList',
			{
				page :1,
				level : level,
				limit :10
			},function(res){
				if(res.code == 200){
					if(res )
					app.tpl($('.fansShopDetail'),'tpl-fansShopDetail',res);
					else{
						$('.fansShopDetail').html("<div class='tC promp-order' style='position:absolute;top:50%;left:15%;height:30%;width:70%;'><span class='cGrey fS15'>亲  这个页面还没有数据哦~</span></div>");
					}
				}else{
					layer.msg('网络繁忙，请稍候再试');
				}
			});
	},
	loadMore :function(url,data){
		var listLoadingEmpty = '<div style="height:3rem;line-height:3rem;text-align:center;font-size:1.2rem;" class="no-more">努力加载中~<div>';
   		$('.fansShopDetail').append(listLoadingEmpty);
		pro_load_flag = false;
		app.ajax(
			url,
			data,
			function(res){
				$('.fansShopDetail .no-more').remove();
				if(res.code == 200){
						app.tpladd($('.fansShopDetail'),'tpl-fansShopDetail',res);						
						pro_load_page++;
						pro_load_flag = true;
					//page++;
				}else{						
						var listLoadingEmpty = '<div style="height:3rem;line-height:3rem;text-align:center;font-size:1.2rem;">没有更多数据了~<div>';
						$('.fansShopDetail').append(listLoadingEmpty);
				}
			});	
	}
}
var uname = window.sessionStorage.getItem('fansDetail');
uname = JSON.parse(uname);
var level = uname.level;
footer.init();
header.init('粉丝信息');
fansShopDetail.init(level);

window.onload = function(){
	$(window).scroll(function(){
		// 当滚动到距底部以上200像素
		var offset = $(".fansShopDetail").offset(),
		dataType = 0,
		data = {};
		var documentHeight = offset.top + $(".fansShopDetail").height();
		if (documentHeight - $(this).scrollTop() - $(this).height()<100){
			var uname = window.sessionStorage.getItem('fansDetail');
			uname = JSON.parse(uname);
			var level = uname.level;
				data = {
					page :pro_load_page,
					level : level,
					limit : 10
				};
			pro_load_flag && fansShopDetail.loadMore('/Member/Shop/getRecEqualLevelList',data);
		}
	});
};

 